package Practice;

import java.util.Scanner;

public class SerialNumber {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        arr[0] = sc.nextInt();
        int num =1,count = 1;
        for (int i = 1; i < n; i++) {
            arr[i] = sc.nextInt();
            if (arr[i] == arr[i-1] + 1){
                num++;
            }
            if (num >= count){
                count = num;
            }
            if (arr[i] != arr[i-1] + 1){
                num = 1;
            }
        }

        System.out.println(count);
    }
}
